<?php
declare (strict_types = 1);

namespace app\model;

use think\Model;
use think\facade\Db;
/**
 * @mixin \think\Model
 */
class User extends Model
{
    public static  function getUser($data) {
      $user = self::where('openid',$data['openid']) -> find();
      if($user) {
          return $user['id'];
      } else {
        return  Db::name('user')->insertGetId($data);
      }

    }
}
